package com.tron.dobest.java.trontest;

import com.tron.dobest.common.BaseEntity;
import lombok.Data;
import lombok.ToString;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Data
@ToString(callSuper = true)
public class MyData extends BaseEntity {
    public String a;

    public static void main(String[] args) {
        String[] ids = {"1","2",};
        String start = "{\"terms\":{\"createDepId\":[";
        String end = "]}}";
        String idString = "";
        List<String> collect = Arrays.stream(ids).filter(e -> !("".equals(e))).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            if (StringUtils.hasText(collect.get(i))) {
                idString+="\""+collect.get(i)+"\"";
                if ((i < collect.size()-1)) {
                    idString += ",";
                }
            }
        }
        System.out.println(start + idString + end);
        ArrayList<String> strings = new ArrayList<>();
        System.out.println("hello world");
    }
}
